package com.fyt.algorithm.Leecode.day8_5;

public class SetZeroes {
    /**
     * 标记数组方案
     * @param matrix
     */
    public void setZeroes(int[][] matrix){
        int r=matrix.length ,c=matrix[0].length;
        boolean[] row = new boolean[r];
        boolean[] col = new boolean[c];

        for (int i = 0; i <r ; i++) {
            for (int j = 0; j < c; j++) {
                if(matrix[i][j]==0){
                    row[i]=true;
                    col[j]=true;
                }
            }

        }
        for (int i = 0; i <r ; i++) {
            for (int j = 0; j <c ; j++) {
                if(row[i]||col[j]){
                    matrix[i][j]=0;
                }
            }
        }


    }



}
